Method | GetSearchResults |
The GetSearchResults operation conducts a search of the Catalog in the context of the shopper. The results of the search are any Items that match the criteria specified.
Items which the shopper cannot see will not be included in the results.
Data fields searched are determined by the Item and Category search field setup options in the General tab the Site Manager > Site Configuration screen.
The search algorithm used is based on the search settings for the Site found in the General tab of the Site Manager > Site Configuration screen, which also affects the ranking of results.
Sorting sequence within the ranked results is based on the default listing sort by setting in the General tab of the Site Manager > Catalog Configuration screen.
Developer's Tip:
To constrain search scope to a single category, specify the SearchCategoryID parameter to the desired Category's Category_ID value and the IncludeItemsFromAllChildCategories parameter to false.
To expand search scope to include all Items, specify a SearchCategoryID of '-1' and the IncludeItemsFromAllChildCategories parameter to true
The request body is of type GetSearchResults.
Name | Description | Data Type |
---|---|---|
SearchString | The text to search for. | xml:string |
SearchCategoryID | The Category_ID of the Category which defines the scope to search within. A value of '-1', or an invalid Category_ID will result in using the top level as the category scope. | xml:string |
IncludeItemsFromAllChildCategories | Determines if scope is contained to just the Category specified in the SearchCategoryID, or extend to all the child Category levelds under the initial Category. A value of true includes all sub-categories, where false contains the search to the intiial Category. | xml:boolean |
IncludeModels | Determines if Items which are Models are to be returned in resluts. A value of true will return Models, false will exclude them. | xml:boolean |
IncludeStockCodes | Determines if Items which are Stock Codes are to be returned in resluts. A value of true will return Stock Codes, false will exclude them. | xml:boolean |
IncludeSKUs | Determines if Items which are SKUs are to be returned in resluts. A value of true will return SKUs, false will exclude them. | xml:boolean |
// Example: Search for Items // using the search term 'Bikes' // in the top level Category // and any children categories down the category hierarchy // and // are Models, or // are Stock Codes, or // are SKUs // then send the response to the browser console MakeAJAXCall("GetSearchResults", { SearchString: 'bike', SearchCategoryID: -1, IncludeItemsFromAllChildCategories: true, IncludeModels: true, IncludeStockCodes: true, IncludeSKUs: true }, console.log);
The response body is of type GetSearchResultsResponse.
Name | Description | Data Type |
---|---|---|
GetSearchResultsResult | A string value containing a JSON object. [{ "Item_ID": 614, "RANK": 80, "StockCode": "A201", "Name": "Bicycle Chain and Lock", "Headline": "Heavy Duty Lock ", "SubHeadline": "Protect your bike! ", "ShortDescription": "Heavy-duty solid-steel construction ", "Link1": "", "Model_ID": 0, "SortOrder": 0, "LongDescription2": "Distrib./Alternate Supplier", "ITM_Item.SortOrder": 0, "CanAddToCart": true }, { "Item_ID": 605, "RANK": 64, "StockCode": "A130", "Name": "18 Speed Racing Bike Boys", "Headline": "Racing Bike", "SubHeadline": "18 Speed - Boys", "ShortDescription": "Cruise the neighborhood on this stylish, 18-speed comfort bike.", "Link1": "", "Model_ID": 0, "SortOrder": 10, "LongDescription2": "Distribution/Goods in Transit", "ITM_Item.SortOrder": 4, "CanAddToCart": false }, { "Item_ID": 608, "RANK": 64, "StockCode": "A133", "Name": "18 Speed Racing Bike Men", "Headline": "Racing Bike", "SubHeadline": "18 Speed - Men", "ShortDescription": "Cruise the neighborhood on this stylish, 18-speed comfort bike.", "Link1": "", "Model_ID": 0, "SortOrder": 4, "LongDescription2": "Distribution/Goods in Transit", "ITM_Item.SortOrder": 2, "CanAddToCart": true }, { "Item_ID": 579, "RANK": 48, "StockCode": "A100", "Name": "Boys 15 Speed Mountain Bike", "Headline": "Mountain Bike", "SubHeadline": "", "ShortDescription": "", "Link1": "", "Model_ID": 0, "SortOrder": 10, "LongDescription2": "Distribution", "ITM_Item.SortOrder": 0, "CanAddToCart": true }, { "Item_ID": 581, "RANK": 48, "StockCode": "A102", "Name": "15\u0027 Speed Mountain Bike Ladies", "Headline": "Mountain Bike", "SubHeadline": "", "ShortDescription": "", "Link1": "", "Model_ID": 0, "SortOrder": 8, "LongDescription2": "Distribution", "ITM_Item.SortOrder": 2, "CanAddToCart": true }, { "Item_ID": 590, "RANK": 48, "StockCode": "A103", "Name": "15 Speed Mountain Bike Men", "Headline": "Mountain Bike", "SubHeadline": "", "ShortDescription": "", "Link1": "", "Model_ID": 0, "SortOrder": 16, "LongDescription2": "Distribution", "ITM_Item.SortOrder": 1, "CanAddToCart": true }, { "Item_ID": 591, "RANK": 48, "StockCode": "A110", "Name": "18 Speed Mountain Bike Boys", "Headline": "Mountain Bike", "SubHeadline": "", "ShortDescription": "", "Link1": "", "Model_ID": 0, "SortOrder": 14, "LongDescription2": "Distribution/Kit Component", "ITM_Item.SortOrder": 7, "CanAddToCart": true }, { "Item_ID": 592, "RANK": 48, "StockCode": "A111", "Name": "18 Speed Mountain Bike Girls", "Headline": "Mountain Bike", "SubHeadline": "", "ShortDescription": "", "Link1": "", "Model_ID": 0, "SortOrder": 12, "LongDescription2": "Distribution", "ITM_Item.SortOrder": 4, "CanAddToCart": true }] | xml:string |